package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

@Entity
public class Contact {
    private int contactId;
    private String contactSex;
    private String contactLx;
    private Date contactTime;
    private Integer contactPhine;
    private Integer contactQq;
    private String contactEmail;
    private String contactBz;
    private String contactName;
    private Client kh;
    private List<Xsjhinfo> xsjh;
    private List<Bjxqinfo> bjxq;
    private List<Bjxqinfo> bj;

    @Id
    @Column(name = "contact_id", nullable = false)
    public int getContactId() {
        return contactId;
    }

    public void setContactId(int contactId) {
        this.contactId = contactId;
    }

    @Basic
    @Column(name = "contact_sex", nullable = true, length = 10)
    public String getContactSex() {
        return contactSex;
    }

    public void setContactSex(String contactSex) {
        this.contactSex = contactSex;
    }

    @Basic
    @Column(name = "contact_lx", nullable = true, length = 20)
    public String getContactLx() {
        return contactLx;
    }

    public void setContactLx(String contactLx) {
        this.contactLx = contactLx;
    }

    @Basic
    @Column(name = "contact_time", nullable = true)
    public Date getContactTime() {
        return contactTime;
    }

    public void setContactTime(Date contactTime) {
        this.contactTime = contactTime;
    }

    @Basic
    @Column(name = "contact_phine", nullable = true)
    public Integer getContactPhine() {
        return contactPhine;
    }

    public void setContactPhine(Integer contactPhine) {
        this.contactPhine = contactPhine;
    }

    @Basic
    @Column(name = "contact_qq", nullable = true)
    public Integer getContactQq() {
        return contactQq;
    }

    public void setContactQq(Integer contactQq) {
        this.contactQq = contactQq;
    }

    @Basic
    @Column(name = "contact_email", nullable = true, length = 20)
    public String getContactEmail() {
        return contactEmail;
    }

    public void setContactEmail(String contactEmail) {
        this.contactEmail = contactEmail;
    }

    @Basic
    @Column(name = "contact_bz", nullable = true, length = 200)
    public String getContactBz() {
        return contactBz;
    }

    public void setContactBz(String contactBz) {
        this.contactBz = contactBz;
    }

    @Basic
    @Column(name = "contact_name", nullable = true, length = 20)
    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Contact contact = (Contact) o;
        return contactId == contact.contactId &&
                Objects.equals(contactSex, contact.contactSex) &&
                Objects.equals(contactLx, contact.contactLx) &&
                Objects.equals(contactTime, contact.contactTime) &&
                Objects.equals(contactPhine, contact.contactPhine) &&
                Objects.equals(contactQq, contact.contactQq) &&
                Objects.equals(contactEmail, contact.contactEmail) &&
                Objects.equals(contactBz, contact.contactBz) &&
                Objects.equals(contactName, contact.contactName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(contactId, contactSex, contactLx, contactTime, contactPhine, contactQq, contactEmail, contactBz, contactName);
    }

    @ManyToOne
    @JoinColumn(name = "client_id", referencedColumnName = "client_id")
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @OneToMany(mappedBy = "khlxr")
    public List<Xsjhinfo> getXsjh() {
        return xsjh;
    }

    public void setXsjh(List<Xsjhinfo> xsjh) {
        this.xsjh = xsjh;
    }

    @OneToMany(mappedBy = "jsr")
    public List<Bjxqinfo> getBjxq() {
        return bjxq;
    }

    public void setBjxq(List<Bjxqinfo> bjxq) {
        this.bjxq = bjxq;
    }

    @OneToMany(mappedBy = "bjr")
    public List<Bjxqinfo> getBj() {
        return bj;
    }

    public void setBj(List<Bjxqinfo> bj) {
        this.bj = bj;
    }
}
